home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1997 July: Mac OS SDK / Dev.CD Jul 97 SDK1.toast / Development Kits (Disc 1) / Interfaces&Libraries / Interfaces / PInterfaces / Kernel.p < prev    next >
Encoding:
Text File  |  1996-09-22  |  7.6 KB  |  277 lines  |  [TEXT/MPS ]

  1. {
  2.      File:        Kernel.p
  3.  
  4.      Contains:    Kernel Interfaces
  5.  
  6.      Version:    Technology:    PowerSurge 1.0.2
  7.                  Package:    Universal Interfaces 2.1.4
  8.  
  9.      Copyright:    © 1984-1995 by Apple Computer, Inc.
  10.                  All rights reserved.
  11.  
  12.      Bugs?:        If you find a problem with this file, use the Apple Bug Reporter
  13.                  stack.  Include the file and version information (from above)
  14.                  in the problem description and send to:
  15.                      Internet:    apple.bugs@applelink.apple.com
  16.                      AppleLink:    APPLE.BUGS
  17.  
  18. }
  19.  
  20. {$IFC UNDEFINED UsingIncludes}
  21. {$SETC UsingIncludes := 0}
  22. {$ENDC}
  23.  
  24. {$IFC NOT UsingIncludes}
  25.  UNIT Kernel;
  26.  INTERFACE
  27. {$ENDC}
  28.  
  29. {$IFC UNDEFINED __KERNEL__}
  30. {$SETC __KERNEL__ := 1}
  31.  
  32. {$I+}
  33. {$SETC KernelIncludes := UsingIncludes}
  34. {$SETC UsingIncludes := 1}
  35.  
  36. {$IFC UNDEFINED __TYPES__}
  37. {$I Types.p}
  38. {$ENDC}
  39. {$IFC UNDEFINED __MACHINEEXCEPTIONS__}
  40. {$I MachineExceptions.p}
  41. {$ENDC}
  42.  
  43. {$PUSH}
  44. {$ALIGN POWER}
  45. {$LibExport+}
  46.  
  47. {  Kernel basics }
  48.  
  49. TYPE
  50.     AddressSpaceID = ^LONGINT;
  51.     IOPreparationID = ^LONGINT;
  52.     SoftwareInterruptID = ^LONGINT;
  53.     TaskID = ^LONGINT;
  54.     TimerID = ^LONGINT;
  55.     
  56. {  OrderedItems }
  57.     OrderedItemService                    = OSType;
  58.     OrderedItemSignature                = OSType;
  59.  
  60. CONST
  61.     kMatchAnyOrderedItemService    = '****';
  62.     kMatchAnyOrderedItemSignature = '****';
  63.     kDoNotMatchAnyOrderedItemService = '----';
  64.     kDoNotMatchAnyOrderedItemSignature = '----';
  65.  
  66.  
  67. TYPE
  68.     OrderedItemNamePtr = ^OrderedItemName;
  69.     OrderedItemName = RECORD
  70.         service:                OrderedItemService;
  71.         signature:                OrderedItemSignature;
  72.     END;
  73.  
  74.     OrderedItemOptions                    = OptionBits;
  75.  
  76. CONST
  77.     kOrderedItemIsRightBefore    = $00000001;
  78.     kOrderedItemIsRightAfter    = $00000002;
  79.  
  80.  
  81. TYPE
  82.     OrderRequirementsPtr = ^OrderRequirements;
  83.     OrderRequirements = RECORD
  84.         options:                OrderedItemOptions;
  85.         itemBefore:                OrderedItemName;
  86.         itemAfter:                OrderedItemName;
  87.     END;
  88.  
  89. {  Tasking }
  90.     ExecutionLevel                        = UInt32;
  91.  
  92. CONST
  93.     kTaskLevel                    = 0;
  94.     kSoftwareInterruptLevel        = 1;
  95.     kAcceptFunctionLevel        = 2;
  96.     kKernelLevel                = 3;
  97.     kSIHAcceptFunctionLevel        = 4;
  98.     kSecondaryInterruptLevel    = 5;
  99.     kHardwareInterruptLevel        = 6;
  100.  
  101.  
  102. TYPE
  103.     SoftwareInterruptHandler = ProcPtr;  { PROCEDURE SoftwareInterruptHandler(p1: UNIV Ptr; p2: UNIV Ptr); C; }
  104.  
  105.     SecondaryInterruptHandler2 = ProcPtr;  { FUNCTION SecondaryInterruptHandler2(p1: UNIV Ptr; p2: UNIV Ptr): OSStatus; C; }
  106.  
  107. {  Memory System basics }
  108.  
  109. CONST
  110.     kNoAreaID                    = 0;
  111.  
  112.  
  113. TYPE
  114.     LogicalAddressRangePtr = ^LogicalAddressRange;
  115.     LogicalAddressRange = RECORD
  116.         address:                LogicalAddress;
  117.         count:                    ByteCount;
  118.     END;
  119.  
  120.     PhysicalAddressRangePtr = ^PhysicalAddressRange;
  121.     PhysicalAddressRange = RECORD
  122.         address:                PhysicalAddress;
  123.         count:                    ByteCount;
  124.     END;
  125.  
  126. {  For PrepareMemoryForIO and CheckpointIO }
  127.     IOPreparationOptions                = OptionBits;
  128.  
  129. CONST
  130.     kIOMultipleRanges            = $00000001;
  131.     kIOLogicalRanges            = $00000002;
  132.     kIOMinimalLogicalMapping    = $00000004;
  133.     kIOShareMappingTables        = $00000008;
  134.     kIOIsInput                    = $00000010;
  135.     kIOIsOutput                    = $00000020;
  136.     kIOCoherentDataPath            = $00000040;
  137.     kIOTransferIsLogical        = $00000080;
  138.     kIOClientIsUserMode            = $00000080;
  139.  
  140.  
  141. TYPE
  142.     IOPreparationState                    = OptionBits;
  143.  
  144. CONST
  145.     kIOStateDone                = $00000001;
  146.  
  147.     kInvalidPageAddress            = -1;
  148.  
  149.  
  150. TYPE
  151.     AddressRangePtr = ^AddressRange;
  152.     AddressRange = RECORD
  153.         base:                    Ptr;
  154.         length:                    ByteCount;
  155.     END;
  156.  
  157. {  C's treatment of arrays and array pointers is atypical }
  158.     LogicalMappingTablePtr                = ^LogicalAddress;
  159.     PhysicalMappingTablePtr                = ^PhysicalAddress;
  160.     AddressRangeTablePtr                = ^AddressRange;
  161.     MultipleAddressRangePtr = ^MultipleAddressRange;
  162.     MultipleAddressRange = RECORD
  163.         entryCount:                ItemCount;
  164.         rangeTable:                AddressRangeTablePtr;
  165.     END;
  166.  
  167. {  Separate C definition so that union has a name.  A future version of the interfacer }
  168. {  tool will allow a name (that gets thrown out in Pascal and Asm). }
  169.     IOPreparationTablePtr = ^IOPreparationTable;
  170.     IOPreparationTable = RECORD
  171.         options:                IOPreparationOptions;
  172.         state:                    IOPreparationState;
  173.         preparationID:            IOPreparationID;
  174.         addressSpace:            AddressSpaceID;
  175.         granularity:            ByteCount;
  176.         firstPrepared:            ByteCount;
  177.         lengthPrepared:            ByteCount;
  178.         mappingEntryCount:        ItemCount;
  179.         logicalMapping:            LogicalMappingTablePtr;
  180.         physicalMapping:        PhysicalMappingTablePtr;
  181.         CASE INTEGER OF
  182.         0: (
  183.             range:                AddressRange;
  184.             );
  185.         1: (
  186.             multipleRanges:        MultipleAddressRange;
  187.             );
  188.     END;
  189.  
  190.     IOCheckpointOptions                    = OptionBits;
  191.  
  192. CONST
  193.     kNextIOIsInput                = $00000001;
  194.     kNextIOIsOutput                = $00000002;
  195.     kMoreIOTransfers            = $00000004;
  196.  
  197. {  For SetProcessorCacheMode }
  198.  
  199. TYPE
  200.     ProcessorCacheMode                    = UInt32;
  201.  
  202. CONST
  203.     kProcessorCacheModeDefault    = 0;
  204.     kProcessorCacheModeInhibited = 1;
  205.     kProcessorCacheModeWriteThrough = 2;
  206.     kProcessorCacheModeCopyBack    = 3;
  207.  
  208. {  For GetPageInformation and UnmapMemory }
  209.     kPageInformationVersion        = 0;
  210.  
  211.  
  212. TYPE
  213.     PageStateInformation                = UInt32;
  214.  
  215. CONST
  216.     kPageIsProtected            = $00000001;
  217.     kPageIsProtectedPrivileged    = $00000002;
  218.     kPageIsModified                = $00000004;
  219.     kPageIsReferenced            = $00000008;
  220.     kPageIsLocked                = $00000010;
  221.     kPageIsResident                = $00000020;
  222.     kPageIsShared                = $00000040;
  223.     kPageIsWriteThroughCached    = $00000080;
  224.     kPageIsCopyBackCached        = $00000100;
  225.  
  226.  
  227. TYPE
  228.     PageInformationPtr = ^PageInformation;
  229.     PageInformation = RECORD
  230.         area:                    AreaID;
  231.         count:                    ItemCount;
  232.         information:            ARRAY [0..0] OF PageStateInformation;
  233.     END;
  234.  
  235.     IteratorKey                            = UInt32;
  236. {   Hardware Interrupt related declarations   }
  237.     InterruptVector                        = UInt32;
  238.     InterruptVectorHandler = ProcPtr;  { PROCEDURE InterruptVectorHandler(theVector: InterruptVector; theParameter: UNIV Ptr); C; }
  239.  
  240. FUNCTION CurrentExecutionLevel: ExecutionLevel; C;
  241. FUNCTION CurrentTaskID: TaskID; C;
  242. FUNCTION DelayFor(expirationTime: Duration): OSStatus; C;
  243. {   Software Interrupts   }
  244. FUNCTION CreateSoftwareInterrupt(handler: SoftwareInterruptHandler; task: TaskID; p1: UNIV Ptr; persistent: BOOLEAN; VAR softwareInterrupt: SoftwareInterruptID): OSStatus; C;
  245. FUNCTION SendSoftwareInterrupt(softwareInterrupt: SoftwareInterruptID; p2: UNIV Ptr): OSStatus; C;
  246. FUNCTION DeleteSoftwareInterrupt(softwareInterrupt: SoftwareInterruptID): OSStatus; C;
  247. PROCEDURE RunSoftwareInterrupts; C;
  248. {   Secondary Interrupts   }
  249. FUNCTION CallSecondaryInterruptHandler2(handler: SecondaryInterruptHandler2; exceptionHandler: ExceptionHandler; p1: UNIV Ptr; p2: UNIV Ptr): OSStatus; C;
  250. FUNCTION QueueSecondaryInterruptHandler(handler: SecondaryInterruptHandler2; exceptionHandler: ExceptionHandler; p1: UNIV Ptr; p2: UNIV Ptr): OSStatus; C;
  251. {   Timers   }
  252. FUNCTION SetInterruptTimer({CONST}VAR expirationTime: AbsoluteTime; handler: SecondaryInterruptHandler2; p1: UNIV Ptr; VAR timer: TimerID): OSStatus; C;
  253. FUNCTION CancelTimer(timer: TimerID; VAR timeRemaining: AbsoluteTime): OSStatus; C;
  254. {   IO related Operations   }
  255. FUNCTION PrepareMemoryForIO(VAR theIOPreparationTable: IOPreparationTable): OSStatus; C;
  256. FUNCTION CheckpointIO(thePreparationID: IOPreparationID; theOptions: IOCheckpointOptions): OSStatus; C;
  257. {   Memory Operations   }
  258. FUNCTION GetPageInformation(theAddressSpace: AddressSpaceID; theBase: LogicalAddress; theLength: ByteCount; theVersion: PBVersion; VAR thePageInfo: PageInformation): OSStatus; C;
  259. {   Processor Cache Related   }
  260. FUNCTION SetProcessorCacheMode(theAddressSpace: AddressSpaceID; theBase: UNIV Ptr; theLength: ByteCount; theMode: ProcessorCacheMode): OSStatus; C;
  261. {   Debugging   }
  262. PROCEDURE SysDebug; C;
  263. PROCEDURE SysDebugStr(str: StringPtr); C;
  264. {   Hardware Interrupts   }
  265. FUNCTION InstallInterruptVectorHandler(theVector: InterruptVector; theHandler: InterruptVectorHandler; theExceptionHandler: ExceptionHandler; theParameter1: UNIV Ptr): OSStatus; C;
  266. FUNCTION RemoveInterruptVectorHandler(theVector: InterruptVector; theHandler: InterruptVectorHandler): OSStatus; C;
  267. {$ALIGN RESET}
  268. {$POP}
  269.  
  270. {$SETC UsingIncludes := KernelIncludes}
  271.  
  272. {$ENDC} {__KERNEL__}
  273.  
  274. {$IFC NOT UsingIncludes}
  275.  END.
  276. {$ENDC}
  277.